home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
pda.h.z
/
pda.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
9KB
|
274 lines
/**************************************************************************
* *
* Copyright (C) 1986, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ifndef __SYS_PDA_H__
#define __SYS_PDA_H__
#ident "$Revision: 3.49 $"
/*
* The private data area for each processor
* Always appears at the same virtual address in each processor
* It is one page 4K large, and we use the top section as a boot/idle stack
*/
/*
* the pda itself
*/
typedef struct pda_s {
union {
int dbg[4];
struct {
int *utlbmiss; /* utlbmiss handler */
int *exceptnorm; /* general exception handler */
int filler[2];
} common;
} db;
int p_cpuid; /* my processor ID */
int p_cpumask; /* my processor ID mask */
int p_runrun; /* switch on return to user */
uint p_kstackflag; /* kernel stack flag */
caddr_t p_intstack; /* base of interrupt stack */
caddr_t p_intlastframe; /* last frame on interrupt stack */
caddr_t p_bootstack; /* base of boot/idle stack */
caddr_t p_bootlastframe;/* last frame on boot/idle stack */
int p_nested_intr; /* in nested interrupt */
int p_atsave;
int p_t0save;
/* fields for segment table manipulation */
int p_k1save; /* save k1 */
caddr_t *p_gsegtbl; /* global segment table */
caddr_t p_idlstkdepth; /* store sp on interrupt on idl stack */
int p_flags; /* various flags */
struct proc *p_curproc; /* current process */
int p_curpri; /* current priority */
struct proc *p_lastproc; /* last process */
int p_ignore; /* last process ignored by parent */
int p_cputype_word; /* cpu rev */
int p_fputype_word; /* fpu rev */
int p_nofault; /* processor nofaults */
caddr_t p_kvfault; /* processor kernel fault history */
struct proc *p_fpowner; /* process owning fpu */
int p_switching; /* processor in swtch */
int p_idleflag; /* processor idle */
int p_idletkn; /* reasons of processor idle */
int p_lticks; /* ticks left in time slice */
int p_vmeipl; /* non-kmode VME interrupt level */
int p_curlock; /* address of lock cpu is going after */
int p_lastlock; /* addr of last lock locked */
int p_curlockcpc; /* calling pc */
int p_savespl; /* previous spl of spsemahi */
int p_gfx_waitc; /* waiting for gfx context swtch */
int p_gfx_waitf; /* waiting for gfx fifo */
unsigned *prfptr; /* ptr to profiler count table */
struct ksa *ksaptr; /* ptr to kernel system activities buf*/
struct action_s *p_todolist; /* list of actions to do for others */
struct action_s *p_lasttodo; /* last actions to do for others */
int p_triggersave; /* 3-way trigger state (IP5 only) */
/*
* Local LED pattern maintainence.
*/
unsigned p_led_counter;
unsigned p_led_value;
unsigned p_dbgcntdown; /* ticks between debugger checks */
/*
* Special modifications lock. Used to allow other processors
* to change p_flags or p_vmeipl (to distribute functionality).
*/
lock_t p_special;
int p_cputype; /* 0 for IP7, 1 for IP5 (MP only) */
/* data needed for updating timetv via fast clock */
int p_fastick;
/* for handling timein */
int p_timein; /* set by timepoke */
int p_ftimein; /* set by fast_timnepoke */
int fclock_freq; /* freq of profiling clock */
int p_schedflags; /* scheduling flags mod by owner only */
struct shaddr_s *p_dispatch; /* Share group to dispatch member of */
uint p_acvec; /* opcode vector for cpuvaction() */
uint p_delayacvec; /* opcode vector for delay action */
uint p_upglo; /* tlblo entry for upage */
uint p_ukstklo; /* tlblo entry for ukstk */
uint p_utlbmisses; /* count utlbmisses */
uint p_sv1lo; /* tlblo entry for save of slot 1 */
uint p_sv1lo_1; /* r4k: 2nd tlblo entry for slot 1 */
uint p_sv1hi; /* tlbhi entry for save of slot 1 */
uint p_sv2lo; /* tlblo entry for save of slot 2 */
uint p_sv2lo_1; /* r4k: 2nd tlblo entry for slot 2 */
uint p_sv2hi; /* tlbhi entry for save of slot 2 */
/* data needed to handle IO intr */
uint *ioep[2]; /* exception frame ptr */
int iopend[2]; /* accumulated io pending bits */
int preempted_iolv[2]; /* io levels being preempted */
/* delay calibration info */
int decinsperloop; /* deci-nanoseconds per DELAY loop */
/* floating point interrupt data */
int p_epcinst; /* instruction at epc */
int p_bdinst; /* instruction in bd slot */
} pda_t;
/*
* sysmp(MP_STAT) structure
*/
struct pda_stat {
int p_cpuid; /* processor ID */
int p_flags; /* various flags */
};
#define common_utlb db.common.utlbmiss
#define common_excnorm db.common.exceptnorm
/* a couple of macros for readability in fast itimer code */
#define NORMTIMEOUT_LIST 0
#define FASTTIMEOUT_LIST -1 /* must be >MAXCPU or <0 */
/* values for p_flags */
#define PDAF_MASTER 0x0001
#define PDAF_CLOCK 0x0002
#define PDAF_ENABLED 0x0004 /* processor allowed to sched procs */
#define PDAF_FASTCLOCK 0x0008 /* processor handles fastimer */
#define PDAF_ISOLATED 0x0010 /* processor is isolated */
#define PDAF_BROADCAST_OFF 0x0020 /* broadcast intr is not received */
#define PDAF_NONPREEMPTIVE 0x0040 /* processor is not preemptive */
/* ``run-anywhere'' value for p_mustrun */
#define PDA_RUNANYWHERE ((cpuid_t)-1)
/* values for kstackflag */
#define PDA_CURUSRSTK 0 /* currently running on user stack */
#define PDA_CURKERSTK 1 /* currently running on kernel user stack */
#define PDA_CURINTSTK 2 /* currently running on interrupt stack */
#define PDA_CURIDLSTK 3 /* currently running on idle stack */
/* values for p_schedflags */
#define PDAS_KICKIDLE 0x0001 /* do a kickidle later */
typedef struct {
int CpuId;
pda_t *pda;
int spare;
} pdaindr_t;
#ifdef _KERNEL
extern pdaindr_t pdaindr[];
extern int numcpus; /* count of configured cpus */
extern int maskcpus; /* mask of configured cpus */
extern int maxcpus; /* max configured cpus */
extern pda_t *masterpda; /* master processor's pda */
extern cpuid_t getcpuid(void);
extern cpuid_t setmustrun(cpuid_t);
extern void restoremustrun(cpuid_t);
extern int sendintr(cpuid_t, unchar);
#endif
#define PDASZ 1 /* # pages of pda */
#define getpda() ((pda_t *) PDAPAGE)
#define private (*((pda_t *) PDAPAGE))
#define cpuid() ((cpuid_t)(private.p_cpuid))
#define cpumask() (private.p_cpumask)
#define ON_MP(X) if (maxcpus > 1) {X;}
#define IS_MP (maxcpus > 1)
#ifdef _KERNEL
/*
* The following allows other cpus to do things for you
*/
typedef struct action_s {
void (*dofunc)();
void *doarg0;
void *doarg1;
void *doarg2;
void *doarg3;
struct action_s *donext;
} action_t;
void cpuaction(cpuid_t, void (*)(), int , ...);
extern void doactions(void);
extern void cpuvaction(register cpuid_t, register uint);
extern void doacvec(void);
extern void da_flush_tlb(void);
#define A_NOW 0x0001 /* perform this action NOW */
#define A_QUEUE 0x0002 /* perform this action later (at disp time) */
#define DOACTION 0xab /* argument for sendintr() to do actions */
/* Opcodes for the cpu action vector */
#define VA_FORCE_RESCHED 0x4
#define VA_TRY_GANGSCHED 0x8
#define VA_LAST_OP VA_TRY_GANGSCHED
/* Opcodes for the cpu delay action vector */
#define DA_ICACHE_FLUSH 0x1
#define DA_TLB_FLUSH 0x2
#define DA_LAST_OP DA_TLB_FLUSH
/*
* Process tlb management
*/
#if R4000 && JUMP_WAR
extern uint max_jump_war_wired;
extern uint jump_war_set;
#endif
extern lock_t tlbflushlock; /* mp tlb flush lock */
extern unsigned char tlbpids[]; /* array of NPROC * MAXCPU tlbpids */
/* these are the array of tlbpids in use */
/* by each process on different processors */
/* can't be 2-dimensional array since */
/* NPROC and MAXCPU are both tuneable */
extern unsigned char cur_tlbpid[]; /* array of last tlbpids assigned */
#define tlbpid(p) (*((p)->p_tlbpid + cpuid()))
extern void check_delay_tlbflush(int);
extern void check_delay_iflush(void);
/*
* tlbsync() flags
*/
#define TLB_NOSLEEP 0x01
#define STEAL_PHYSMEM 0x02
#define NO_VADDR 0x04
#define SPROC_TLBSYNC 0x08
#define IMMEDIATE_BROADCAST 0x10
/*
* process that is must run on isolated processor will not be paged out, nor
* killed by sched()
*/
#define is_isolated(p) (p->p_mustrun != PDA_RUNANYWHERE && \
pdaindr[p->p_mustrun].pda->p_flags & PDAF_ISOLATED)
/* flags for check_delay_tlbflush() */
#define ENTRANCE 0
#define EXIT 1
#define CHECK_DELAY_TLBFLUSH(flag) {\
if (private.p_flags & PDAF_ISOLATED) \
check_delay_tlbflush(flag); \
}
#define CHECK_DELAY_IFLUSH() {\
if (private.p_flags & PDAF_ISOLATED) \
check_delay_iflush(); \
}
#endif /* _KERNEL */
#endif /* __SYS_PDA_H__ */